<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p = new Promise((resolve, reject) => {
          resolve(1) // 调用resolve，表示状态固定了，结果也就固定了
          reject(2) 
          resolve(3) 
          setTimeout(() => {
            resolve(4) 
          }, 1000)
        })
    
        p.then(res => {
          console.log(res)
        }).catch(err => {
          console.log(err)
        })
      </script>
</body>
</html>